"""
编写一个函数来查找字符串数组中的最长公共前缀。
如果不存在公共前缀，返回空字符串 ""。

示例 1：
输入：strs = ["flower","flow","flight"]
输出："fl"
"""

from typing import List
class Solution:
    def longestCommonPrefix(self, strs: List[str]) -> str:
        min_length = 200
        for i in strs:
            min_length = min(len(i),min_length)
        result = ''
        for i in range(min_length):
            current_char = strs[0][i]
            for j in strs[1:]:
                if j[i] != current_char:
                    return result
            result += current_char
        return result
print(Solution().longestCommonPrefix(["12345","12356","1245"]))
